
import SwiftUI
import Speech
struct testView: View {
    @State private var isButtonPressed = false
    @State private var dragOffset = CGSize.zero

    var body: some View {
        VStack {
            Spacer()
            Button(action: {
                isButtonPressed = true
            }) {
                Text("Press and hold me")
                    .padding()
                    .background(Color.blue)
                    .foregroundColor(.white)
                    .clipShape(Capsule())
            }
            .gesture(
                DragGesture(minimumDistance: 0)
                    .onChanged { value in
                        dragOffset = value.translation
                    }
                    .onEnded { value in
                        print("N")
                        if value.translation.width < -100 {
                            print("Trigger event B")
                        } else if value.translation.width > 100 {
                            print("Trigger event C")
                        } else {
                            print("G")
                            isButtonPressed = false
                            dragOffset = .zero
                            print("Trigger event A")
                        }
                    }
                )
            
                Spacer()
        }
    }
}
struct testView_Previews: PreviewProvider {

//    static var testAddBill = AddBill.testAddBills()
    static var previews: some View {
        testView()
    }
}
